﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Report_Search.aspx.cs"
    Inherits="EcSalseManage.EcSalse.Report_Search" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>项目销售管理系统-查找成交</title>
    <link href="/css/skin.css" type="text/css" rel="stylesheet">

    <script language="javascript" type="text/javascript" src="/js/jquery-1.6.2.min.js"></script>

    <script language="javascript" type="text/javascript" src="/js/My97DatePicker/WdatePicker.js"></script>

    <script language="javascript" type="text/javascript">
        function CheckChildBox(btn, id) {
            var inputs = document.getElementsByTagName("input");
            for (var i = 0; i < inputs.length; i++) {
                var obj = inputs[i];
                if (obj.type == 'checkbox' && obj.id.indexOf(id) >= 0) {
                    obj.checked = btn.checked;
                }
            }
        }
        function validateChklst(sender, args) {
            var type = document.getElementById("ddlExchangeType").value;
            if (type == "") {
                alert("请选择成交类型");
                args.IsValid = false;
            }
            else if (type == "1" || type == "2" || type == "3" || type == "4") {
            if (type == "3" || type == "4") {
                type = "2";
            }

                if ($("#CheckBoxList" + type + " input:checked").length > 0) {
                    args.IsValid = true;
                } else {
                    alert("请勾选复选框内容");
                    args.IsValid = false;
                }
            }else
            {
                args.IsValid = true;
            }
        }

        function view(){

            document.getElementById("div1").style.display = "none";
            document.getElementById("div2").style.display = "none";
            if (document.getElementById("ddlExchangeType").value == "1") {
                document.getElementById("div1").style.display = "block";
            } else if (document.getElementById("ddlExchangeType").value == "2") {
                document.getElementById("div2").style.display = "block";
            }else if (document.getElementById("ddlExchangeType").value == "3"){
                document.getElementById("div2").style.display = "block";
            }else if (document.getElementById("ddlExchangeType").value == "4"){
                document.getElementById("div2").style.display = "block";
            }
        }


        var xmlRequest;
        function getXMLRequestObject() {

            if (window.XMLHttpRequest) {
                xmlRequest = new XMLHttpRequest();
            }
            else if (window.ActiveXObject) {
                xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
            }
            return xmlRequest;
        }

        function getData(flag, id) {


            var url = "GetGridViewByConditionForm.aspx"; //要请求的数据库返回的数据页面
            //得到请求对象
            document.getElementById("msg").style.display = "block";

            xmlRequest = getXMLRequestObject();
            if (xmlRequest == null) {
                alert("您的浏览器不支持AJAX!");
                return;
            }
            if (flag == "load") {
                //load 表示是页面加载数据
                url += "?flag=load&Mainid=" + id + "&temp=" + Math.random();
                //状态改变  
                xmlRequest.onreadystatechange = dataChanged;
                xmlRequest.open("GET", url, true);
                xmlRequest.send(null);  // 发送请求
            } else if (flag == "add") {
                url += "?flag=add&Report_Commission_Money=" + document.getElementById("NewReport_Commission_Money").value + "&Report_Commission_InvoiceNO=" + document.getElementById("NewReport_Commission_InvoiceNO").value + "&temp=" + Math.random();
                //状态改变  
                xmlRequest.onreadystatechange = dataChanged;
                xmlRequest.open("GET", url, true);
                xmlRequest.send(null);  // 发送请求
            } else if (flag == "update") {
                var Report_Commission_InvoiceNO = document.getElementById('txtReport_Commission_InvoiceNO' + id).value;
                var Report_Commission_Money = document.getElementById('txtReport_Commission_Money' + id).value;
                url += "?flag=update&id=" + id + "&Report_Commission_InvoiceNO=" + Report_Commission_InvoiceNO + "&Report_Commission_Money=" + Report_Commission_Money;
                url = encodeURI(url);
                //状态改变  
                xmlRequest.onreadystatechange = dataChanged;
                xmlRequest.open("POST", url, true);
                xmlRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
                xmlRequest.send(url);  // 发送请求
            } else if (flag == "delete") {
                url += "?flag=delete&id=" + id;
                url = encodeURI(url);
                //状态改变  
                xmlRequest.onreadystatechange = dataChanged;
                xmlRequest.open("POST", url, true);
                xmlRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
                xmlRequest.send(url);  // 发送请求
            } else if (flag == "close") {

            }



        }
        function dataChanged() {
            if (xmlRequest.readyState == 4) {
                if (xmlRequest.status == 200) {
                    showDatas(); //已经可以正常接受数据

                } else { //页面不正常  
                    window.alert("您所请求的页面有异常。");
                }
            }
        }
        //表格部分显示数据  
        function showDatas() {
            //从响应页面得到数据
            var message = xmlRequest.responseText;
            var tc = message.substring(message.indexOf('<div id="container">'), message.Length);
            //显示数据
            document.getElementById("ShowSearchResult").innerHTML = tc;

        }

        function changeView(Report_Commission_ID, Report_Commission_InvoiceNO, Report_Commission_Money) {
            objReport_Commission_InvoiceNO = document.getElementById('Report_Commission_InvoiceNO' + Report_Commission_ID);
            objReport_Commission_Money = document.getElementById('Report_Commission_Money' + Report_Commission_ID);
            objManage = document.getElementById('Manage' + Report_Commission_ID);

            objReport_Commission_InvoiceNO.innerHTML = "<input type='text' style='width:47px;'  id='txtReport_Commission_InvoiceNO" + Report_Commission_ID + "'  value='" + Report_Commission_InvoiceNO + "'>";
            objReport_Commission_Money.innerHTML = "<input type='text' style='width:47px;'  id='txtReport_Commission_Money" + Report_Commission_ID + "'  value='" + Report_Commission_Money + "'>";
            objManage.innerHTML = "<a href=javascript:getData('update','" + Report_Commission_ID + "')>更新</a> &nbsp;<a href=javascript:getData('load','')>取消</a>";
        }
        
    </script>

    <style type="text/css">
	.mainDiv { SCROLLBAR-FACE-COLOR: #9999ff; OVERFLOW: auto; WIDTH: expression(document.body.clientWidth-20); HEIGHT: expression((document.body.clientHeight-this.offsetTop-20>this.children[0].offsetHeight)?(this.children[0].offsetHeight+20) : (document.body.clientHeight-this.offsetTop-20)) } 
    TD { FONT-SIZE: 15px }
    </style>
</head>
<body>
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td width="17" valign="top" background="../images/mail_leftbg.gif">
                <img src="../images/left-top-right.gif" width="17" height="29" />
            </td>
            <td valign="top" background="../images/content-bg.gif">
                <table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg"
                    id="table2">
                    <tr>
                        <td height="31">
                            <div class="titlebt">
                                查找成交</div>
                        </td>
                    </tr>
                </table>
            </td>
            <td width="16" valign="top" background="../images/mail_rightbg.gif">
                <img src="../images/nav-right-bg.gif" width="16" height="29" />
            </td>
        </tr>
        <tr>
            <td valign="middle" background="../images/mail_leftbg.gif">
                &nbsp;
            </td>
            <td valign="top" bgcolor="#F7F8F9">
                <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                        <td colspan="4" valign="top">
                            <form id="form1" runat="server">
                            <div>
                                <center>
                                    <table width="800px">
                                        <tr>
                                            <td align="center" style="border-bottom: 1px solid #cccccc;">
                                                <br />
                                                <span id="lblTitle" style="font-size: 28px;">查找成交</span><br />
                                                <br />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                &nbsp;
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="text-align: left;">
                                                <div class="page">
                                                    <table>
                                                        <tr>
                                                            <td>
                                                                &nbsp;
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                &nbsp;&nbsp;&nbsp;成交类型：<asp:DropDownList ID="ddlExchangeType" Width="150px" runat="server">
                                                                </asp:DropDownList>
                                                            </td>
                                                            <td>
                                                                 &nbsp;&nbsp;&nbsp;成交编号：<asp:TextBox ID="txtReportNO" runat="server"></asp:TextBox></td>
                                                            <td>
                                                                &nbsp;&nbsp;&nbsp;成交日期：<asp:TextBox ID="txtExchangeDate" class="Wdate" onclick="WdatePicker({dateFmt:'yyyy/MM/dd'})"
                                                                    runat="server"></asp:TextBox></td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                &nbsp;&nbsp;&nbsp;经办人:<asp:TextBox ID="txtOperator" runat="server"></asp:TextBox></td>
                                                            <td>
                                                                &nbsp;&nbsp;&nbsp;营销总监：<asp:TextBox ID="txtMarketing" runat="server"></asp:TextBox></td>
                                                            <td>
                                                                &nbsp;&nbsp;&nbsp;项目经理:<asp:TextBox ID="txtManager" runat="server"></asp:TextBox></td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="3">
                                                                <div id="div1" runat="server" style="display: none;">
                                                                    <div style="color: Blue; padding-left: 20px;">
                                                                        <asp:CheckBox ID="CheckBox1" onclick="CheckChildBox(this,'CheckBoxList1')" runat="server"
                                                                            Text="策划费报数" /></div>
                                                                    <div style="padding-left: 40px;">
                                                                        <asp:CheckBoxList ID="CheckBoxList1" runat="server" RepeatColumns="5" RepeatDirection="Horizontal">
                                                                            <asp:ListItem Value="field_0001">项目名称</asp:ListItem>
                                                                            <asp:ListItem Value="field_0002">成交报告编号</asp:ListItem>
                                                                            <asp:ListItem Value="field_0003">成交日期</asp:ListItem>
                                                                            <asp:ListItem Value="field_0004">策划费佣金总额</asp:ListItem>
                                                                            <asp:ListItem Value="field_0005">项目部占额</asp:ListItem>
                                                                            <asp:ListItem Value="field_0006">转介部门占额</asp:ListItem>
                                                                            <asp:ListItem Value="field_0007">支付策划费摘要</asp:ListItem>
                                                                            <asp:ListItem Value="field_0008">备注</asp:ListItem>
                                                                        </asp:CheckBoxList>
                                                                    </div>
                                                                </div>
                                                                <div id="div2"  runat="server" style=" display:none;">
                                                                    <div style="color: Blue; padding-left: 20px;">
                                                        <asp:CheckBox ID="CheckBox2" onclick="CheckChildBox(this,'CheckBoxList2')" runat="server"
                                                            Text="销售成交" /></div>
                                                    <div style="padding-left: 40px;">
                                                        <asp:CheckBoxList ID="CheckBoxList2" runat="server" RepeatColumns="5" RepeatDirection="Horizontal">
                                                            <asp:ListItem Value="field_0009">日期</asp:ListItem>
                                                            <asp:ListItem Value="field_0010">成交编号</asp:ListItem>
                                                            <asp:ListItem Value="field_0011">认购书</asp:ListItem>
                                                            <asp:ListItem Value="field_0012">经办人</asp:ListItem>
                                                            <asp:ListItem Value="field_0013">出售单位</asp:ListItem>
                                                            <asp:ListItem Value="field_0014">购房人</asp:ListItem>
                                                            <asp:ListItem Value="field_0015">购房面积</asp:ListItem>
                                                            <asp:ListItem Value="field_0016">折扣</asp:ListItem>
                                                            <asp:ListItem Value="field_0017">付款方式</asp:ListItem>
                                                            <asp:ListItem Value="field_0018">成交价</asp:ListItem>
                                                            <asp:ListItem Value="field_0019">定金</asp:ListItem>
                                                            <asp:ListItem Value="field_0020">代理费</asp:ListItem>
                                                            <asp:ListItem Value="field_0021">挞订佣</asp:ListItem>
                                                            <asp:ListItem Value="field_0022">备注</asp:ListItem>
                                                            <asp:ListItem Value="field_0023">原面积</asp:ListItem>
                                                            <asp:ListItem Value="field_0024">原成交价</asp:ListItem>
                                                            <asp:ListItem Value="field_0025">合作分行和营业员</asp:ListItem>
                                                        </asp:CheckBoxList>
                                                    </div>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                &nbsp;&nbsp;&nbsp;<asp:Button ID="btnSearch" runat="server" Text="查询"   OnClick="btnSearch_Click" />
                                                                <asp:CustomValidator ID="cvConclusion" runat="server" ErrorMessage="" ClientValidationFunction="validateChklst"></asp:CustomValidator>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                &nbsp;
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td  style=" width:400px;">
                                            <div class="mainDiv" style=" width:800px; height:300px;">
           <asp:DataGrid id="dgList1" runat="server" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" OnItemDataBound="dgList1_ItemDataBound"
					BackColor="White" CellPadding="4">
					<FooterStyle ForeColor="#330099" BackColor="#FFFFCC"></FooterStyle>
					<SelectedItemStyle Font-Bold="True" ForeColor="#663399" BackColor="#FFCC66"></SelectedItemStyle>
					<ItemStyle ForeColor="#330099" BackColor="White"></ItemStyle>
					<HeaderStyle Font-Bold="True" ForeColor="#FFFFCC" BackColor="#990000"></HeaderStyle>
					<PagerStyle HorizontalAlign="Center" ForeColor="#330099" BackColor="#FFFFCC"></PagerStyle>
				</asp:DataGrid>

				
                                             </div>
                                                <br />
                                                <br />
                                                <table id="msg" style="display: none; position: absolute; top: 400px; left: 200px;"
                                                    class="iii">
                                                    <tr>
                                                        <td align="right" colspan="2">
                                                            <a href="#" onclick="javascript:document.getElementById('msg').style.display = 'none';"
                                                                style="font-size: smaller">[关闭]</a>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="2">
                                                            <br />
                                                            <center>
                                                                <span style="font-family: Arial; font-size: 28px; font-weight: normal; font-style: normal;
                                                                    text-decoration: none; color: #333333;">收佣过程</span><br />
                                                                <hr style="width: 80%" />
                                                                <br />
                                                            </center>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <div id="ShowSearchResult">
                                                            </div>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                </center>
                            </div>
                            </form>
                            <div id="datadiv">
                            </div>
                        </td>
                    </tr>
        </tr>
        <tr>
            <td height="40" colspan="4">
                <table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
                    <tr>
                        <td>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td width="2%">
                &nbsp;
            </td>
            <td width="51%" class="left_txt">
                <img src="../images/icon-mail2.gif" width="16" height="11">
                客户服务邮箱：servers@centaline.com<br>
                <img src="../images/icon-phone.gif" width="17" height="14">
                官方网站：http://www.centaline.com.cn/
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
    </table>
    </td>
    <td background="../images/mail_rightbg.gif">
        &nbsp;
    </td>
    </tr>
    <tr>
        <td valign="bottom" background="../images/mail_leftbg.gif">
            <img src="../images/buttom_left2.gif" width="17" height="17" />
        </td>
        <td background="../images/buttom_bgs.gif">
            <img src="../images/buttom_bgs.gif" width="17" height="17">
        </td>
        <td valign="bottom" background="../images/mail_rightbg.gif">
            <img src="../images/buttom_right2.gif" width="16" height="17" />
        </td>
    </tr>
    </table>
</body>
</html>
